# Creating a new Time Entry

Creates time entries for a user.
**Bulk Create**
This endpoint supports bulk creating up to 100 objects. In the request body, set the top-level key to its plural form and place the objects in an array. Example:

```
{
  "time_entries": [
    {
      "workspace_id": 123,
      "date_performed": "2025-01-23",
      "time_in_minutes": 60
    },
    {
      "workspace_id": 123,
      "date_performed": "2025-01-24",
      "time_in_minutes": 60
    }
  ]
}
```
This endpoint returns structured Time Entry objects.
As with all Kantata OX API endpoints, the returned data will be referenced in sorted order in the `results` array
and will be indexed by ID in the `time_entries` top-level JSON key.
Please see our [Response Format](#section/Response-Format) section for more information.

Endpoint: POST /time_entries
Version: 1.0.0

## Query parameters:

  - `include` (string)
    Any of the below associations can be included in your request by providing the `include` param, e.g. `include=association1,association2`.
- `active_submission` (TimesheetSubmission) - Retrieves the active timesheet (i.e. approved or pending) the time entry was submitted on, if any. The response will include `active_submission_id`, which references the data in the `timesheet_submissions` top-level key.
- `external_references` (ExternalReference) - Includes references to external integrations for this object.
- `invoice` (Invoice) - Retrieves the invoice the time entry was added to, if any. The response will include `invoice_id`, which references the data in the `invoices` top-level key.
- `recent_submission` (TimesheetSubmission) - Retrieves the most recent timesheet the time entry was submitted on, if any, including any rejected or cancelled timesheets. The response will include `recent_submission_id`, which references the data in the `timesheet_submissions` top-level key.
- `role` (Role) - Retrieves the project role of the user who performed the work for the time entry, if any. The response will include `role_id`, which references the data in the `roles` top-level key.
- `story` (Story) - Retrieves the task the time entry is tracked to, if any. The response will include `story_id`, which references the data in the `stories` top-level key.
- `user` (User) - Retrieves the user the time entry belongs to. The response will include `user_id`, which references the data in the `users` top-level key.
- `workspace` (Workspace) - Retrieves the project the time entry is tracked to. The response will include `workspace_id`, which references the data in the `workspaces` top-level key.

  - `optional_fields` (array)
    Allows you to request one or more optional fields as an array.

## Request fields (application/json):

  - `time_entry` (object)

  - `time_entry.workspace_id` (integer, required)
    The ID of the project the time entry is logging work in.

  - `time_entry.date_performed` (string, required)
    The date the activity for which the time is being entered was performed, format: YYYY-MM-DD. The date must be in [ISO 8601](https://www.w3.org/TR/NOTE-datetime) format.

  - `time_entry.time_in_minutes` (integer, required)
    The amount of time in minutes that the activity was worked on.

  - `time_entry.billable` (boolean)
    Whether this Time Entry is billable time. If you don't provide this parameter, `billable` will be defaulted to the
value of the `billable` flag of its associated `Story` if any, otherwise to true.

  - `time_entry.rate_in_cents` (integer)
    The hourly rate for the time entry in cents.

  - `time_entry.notes` (string)
    Any notes added to the time entry. To add line breaks, use `\n`.

  - `time_entry.role_id` (integer)
    The ID of the default Role or user assigned Role for the time entry.

  - `time_entry.story_id` (integer)
    The ID of the task (story) this time entry is associated with.

  - `time_entry.user_id` (integer)
    This is set to the current_user ID by default. This parameter is ignored unless the authorizing
user has financial access in the project and is on the consultants team (or if the authorizing
user is an account administrator and has proxy permissions via an account member with
those permissions).

  - `time_entry.external_reference` (object)
    Typically populated programmatically by a third party system via an integration, this is an optional
object that holds data from an external system. It connects objects in an external system with objects in
Kantata OX (for example, to connect a Jira issue to a Kantata OX Project).

  - `time_entry.external_reference.service_name` (string, required)
    The provider name of the integration. If you are adding multiple external references to the same object, the `service_name` must be unique.

  - `time_entry.external_reference.service_model` (string, required)
    The object type of the external object this external reference belongs to.

  - `time_entry.external_reference.service_model_ref` (string, required)
    The object ID of the external object this external reference belongs to.

  - `time_entry.external_reference.status` (string)
    The status of the integration. Options are `successful`, `pending`,  or `failed`.

  - `time_entry.external_reference.external_message` (string)
    The message on the external object.

  - `time_entry.external_reference.external_link` (string)
    The link to the external object.

  - `time_entry.external_reference.external_status` (string)
    The status of the external object in the external system.

  - `time_entry.external_reference.locked` (boolean)
    Whether the subject is locked.

  - `time_entry.location` (string)
    The location of the time entry. Must match the name of an existing account location.

## Response 200 fields (application/json):

  - `count` (integer)

  - `meta` (object)

  - `meta.count` (integer)

  - `meta.page_count` (integer)

  - `meta.page_number` (integer)

  - `meta.page_size` (integer)

  - `results` (array)

  - `results.key` (string)

  - `results.id` (string)

## Response 400 fields (application/json):

  - `errors` (array)

  - `errors.type` (string)

  - `errors.message` (string)

## Response 401 fields (application/json):

  - `errors` (array)

  - `errors.type` (string)

  - `errors.message` (string)

## Response 403 fields (application/json):

  - `errors` (array)

  - `errors.type` (string)

  - `errors.message` (string)

## Response 404 fields (application/json):

  - `errors` (array)

  - `errors.type` (string)

  - `errors.message` (string)

## Response 422 fields (application/json):

  - `errors` (array)

  - `errors.type` (string)

  - `errors.message` (string)

## Response 503 fields (application/json):

  - `errors` (array)

  - `errors.type` (string)

  - `errors.message` (string)

